<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试js测试对象</title>
    <script>
        //创建对象方式1 声明对象
        function Person() {
        }

        //创建对象
        var p = new Person();
        //动态绑定属性
        p.name = "张三";
        p.age = 15;
        console.log(p.age);
        console.log(p)
        //方法二

        var p2 = {
            "pname": "李四",
            "page": 100,
            "psay": function () {
                /*this使用p2里定义的*/
                console.log(this.pname + this.page);
            }
        }
    </script>
</head>
<body>

</body>
</html>